<?php
echo $callbackFunction . '({';
echo '"totalCount":"' . $count . '",';
echo '"hotels":[';
$counter = 0;
foreach ($data as $hotel) {
	$counter++;
	echo '{';
	echo '"id":"' . $hotel->id . '",';
	echo '"hotelTitle":"' . addcslashes(htmlspecialchars($hotel->title, ENT_QUOTES), '\\') . '",';
	echo '"cityTitle":"' . addcslashes(htmlspecialchars($hotel->getRelated('city')->title, ENT_QUOTES), '\\') . '",';
	echo '"stars":"' . (intval($hotel->stars) > 0 ? str_repeat('<img src=\"/public/css/images/star.png\" hspace=\"1\">', $hotel->stars) : '<font color=red>не задано</font>') . '",';
	echo '"actions":"<a href=\"javascript: hotelRooms(' . $hotel->id  . ');\">номера и цены</a>&nbsp;<a href=\"javascript: editHotel(' . $hotel->id  . ');\">изменить</a>&nbsp;<a href=\"javascript: deleteHotel(' . $hotel->id . ');\">удалить</a>"';
	echo '}';
	if ($counter != count($data)) echo ',';
}
echo ']});'; ?>